<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

</body>
<script>

    //将日期转成具体的毫秒
    var date = new Date();
    console.log(date);

    // 事件转毫秒
    // 1. 进行运算 -*/
    var ms = date * 1;
    console.log(ms);

    // 2. date.valueOf();
    var ms = date.valueOf();
    console.log(ms);

    // 3. date.getTime();
    var ms = date.getTime();
    console.log(ms);

    // 4. Date.now();  //主机当前时间   有误差
    var ms = Date.now();
    console.log(ms);

    // Date.parse()    //毫秒始终为0
    var ms = Date.parse(date);
    console.log(ms);
</script>

</html>